---

kind: Deployment
apiVersion: apps/v1
metadata:
  generateName: pvc-affinity-pod-
  namespace: "{{ namespace }}"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: affinity-pod
  template:
    metadata:
      labels:
        app: affinity-pod
    spec:
      containers:
        - name: busybox
          image: gcr.io/distroless/static:debug
          imagePullPolicy: IfNotPresent
          command: ["sh", "-c"]
          args: ["sleep 99999"]
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop: ["ALL"]
            readOnlyRootFilesystem: true
          volumeMounts:
{% for pvc_name in pvc_names %}
            - name: "pvc-{{ pvc_name }}"
              mountPath: "/mnt-{{ pvc_name }}"
{% endfor %}
{% if podSecurityContext is defined %}
      securityContext: {{ podSecurityContext }}
{% endif %}
      terminationGracePeriodSeconds: 2
      volumes:
{% for pvc_name in pvc_names %}
        - name: "pvc-{{ pvc_name }}"
          persistentVolumeClaim:
            claimName: "{{ pvc_name }}"
{% endfor %}
